package com.catchu.pattern.creational.原型模式;

import java.util.Date;
import java.util.UUID;

/**
 * 订单基础类
 */
public class Order implements Cloneable {

    /**
     * 单据id
     */
    private String id;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 创建人
     */
    private String creator;

    /**
     * 单据类型
     */
    private String type;

    public Order() {
    }

    public Order(String id, Date createTime, String creator, String type) {
        this.id = id;
        this.createTime = createTime;
        this.creator = creator;
        this.type = type;
    }

    @Override
    protected Order clone() throws CloneNotSupportedException {
        return new Order(UUID.randomUUID().toString(),new Date(),this.creator,this.type);
    }

    @Override
    public String toString() {
        return "Order{" +
                "id='" + id + '\'' +
                ", createTime=" + createTime +
                ", creator='" + creator + '\'' +
                ", type='" + type + '\'' +
                '}';
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
